﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:selectors="clr-namespace:Controls.Selectors;assembly=Controls">

    <!--  Template de la liste  -->
    <Style x:Key="ListBoxItemBase" TargetType="ListBoxItem">
        <Setter Property="MinHeight" Value="25" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="BorderThickness" Value="0,0,0,1" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="Border"
                            Margin="0,0,0,0"
                            Background="{TemplateBinding Background}"
                            BorderBrush="#FFededed"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="5"
                            SnapsToDevicePixels="True">
                        <ContentPresenter Margin="5, 0, 0, 0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxItemPaire"
           BasedOn="{StaticResource ListBoxItemBase}"
           TargetType="ListBoxItem" />

    <Style x:Key="ListBoxItemImpaire"
           BasedOn="{StaticResource ListBoxItemBase}"
           TargetType="ListBoxItem">
        <!--  <Setter Property="Background" Value="#FFf8f8f8" />  -->
    </Style>

    <selectors:AlternativeListBoxRowSelector x:Key="AlternativeListBoxRowSelector"
                                            LigneImpaire="{StaticResource ListBoxItemImpaire}"
                                            LignePaire="{StaticResource ListBoxItemPaire}" />

    <Style x:Key="ListBoxStevia" TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />

        <Setter Property="ItemContainerStyleSelector" Value="{StaticResource AlternativeListBoxRowSelector}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="30" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="0"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                Background="{DynamicResource BrushBackgroundTitleListBox}"
                                BorderBrush="{DynamicResource BrushBorderModule}"
                                BorderThickness="1,1,0,1"
                                CornerRadius="{DynamicResource CornerRadiusLeftSize}">
                            <TextBlock Margin="0,10,0,0"
                                       HorizontalAlignment="Center"
                                       VerticalAlignment="Top"
                                       FontSize="14"
                                       Foreground="{DynamicResource BrushTitleModule}"
                                       Text="{TemplateBinding Tag}">
                                <TextBlock.LayoutTransform>
                                    <RotateTransform Angle="-90" />
                                </TextBlock.LayoutTransform>
                            </TextBlock>
                        </Border>
                        <Border Grid.Column="1"
                                Background="{DynamicResource BackgroundListModuleBrush}"
                                BorderBrush="{DynamicResource BrushBorderModule}"
                                BorderThickness="0,1,1,1"
                                CornerRadius="{DynamicResource CornerRadiusBottomSize}">
                            <ScrollViewer Width="{TemplateBinding Width}"
                                          HorizontalScrollBarVisibility="Disabled"
                                          VerticalScrollBarVisibility="Auto">
                                <StackPanel IsItemsHost="True" Orientation="Vertical" />
                            </ScrollViewer>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  ListBox transparente  -->
    <Style x:Key="ListBoxTransparent" TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Border Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="Transparent"
                            BorderThickness="0"
                            CornerRadius="0">
                        <ScrollViewer Margin="0" Focusable="false">
                            <StackPanel Margin="0"
                                        HorizontalAlignment="Left"
                                        IsItemsHost="True" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxTransparentHorizontal" TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Border Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="Transparent"
                            BorderThickness="0"
                            CornerRadius="0">
                        <ScrollViewer Margin="0" Focusable="false">
                            <StackPanel Margin="0"
                                        HorizontalAlignment="Left"
                                        IsItemsHost="True"
                                        Orientation="Horizontal" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxTransparentTool" TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Border Background="{TemplateBinding Background}"
                                BorderThickness="0"
                                CornerRadius="0">
                            <StackPanel HorizontalAlignment="Left"
                                        IsItemsHost="True"
                                        Orientation="Vertical" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Margin="0"
                                            IsItemsHost="True"
                                            Orientation="Vertical" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ListBoxItem">
                                <ContentPresenter />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxTransparentPanelTool" TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Border Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="Transparent"
                            BorderThickness="0"
                            CornerRadius="0">
                        <ScrollViewer Margin="0" Focusable="false">
                            <UniformGrid Margin="0"
                                         Columns="2"
                                         IsItemsHost="True" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ItemTransparent" TargetType="ListBoxItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding" Value="2,0,0,0" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true" />
                                <Condition Property="Selector.IsSelectionActive" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ItemTransparentWithNoCursor" TargetType="ListBoxItem" BasedOn="{StaticResource ItemTransparent}">
        <Setter Property="Cursor" Value="Arrow" />
    </Style>
    
    <Style x:Key="ListBoxTransparentWithItemsTransparent"
           BasedOn="{StaticResource ListBoxTransparent}"
           TargetType="ListBox">
        <Setter Property="ItemContainerStyle" Value="{StaticResource ItemTransparent}" />
        <Style.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
        </Style.Resources>
    </Style>

    <Style x:Key="ListBoxTransparentWithItemsTransparentHorizontal" TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource ItemTransparent}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Border Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="Transparent"
                            BorderThickness="0"
                            CornerRadius="0">
                        <ScrollViewer Margin="0" Focusable="false">
                            <StackPanel Margin="0"
                                        HorizontalAlignment="Left"
                                        IsItemsHost="True"
                                        Orientation="Horizontal" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
        </Style.Resources>
    </Style>

    <Style x:Key="ItemBaseList" TargetType="ListBoxItem">
        <Setter Property="Cursor" Value="Hand" />
    </Style>

    <Style TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="ItemContainerStyle" Value="{StaticResource ItemTransparent}" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <UniformGrid Margin="0,5,0,0"
                                 VerticalAlignment="Top"
                                 Rows="4" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Style.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
        </Style.Resources>
    </Style>

    <Style x:Key="ListBoxBorderLightGray" TargetType="ListBox">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Border Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{DynamicResource LightGraySteviaBrush}"
                            BorderThickness="1"
                            CornerRadius="0">
                        <ScrollViewer Margin="0" Focusable="false">
                            <StackPanel Margin="0" IsItemsHost="True" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxBorderLightGrayWithItemsTransparent"
           BasedOn="{StaticResource ListBoxBorderLightGray}"
           TargetType="ListBox">
        <Setter Property="ItemContainerStyle" Value="{StaticResource ItemTransparent}" />
        <Style.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
        </Style.Resources>
    </Style>
</ResourceDictionary>

